package com.saltlux.tdd.algorithm;

import java.util.Arrays;
import java.util.Comparator;

public class InsertionSort {

	public void sort(String[] fixture, Comparator comparator) {
		IndexFinder finder = new IndexFinder();
		InsertionValue insertionValue = new InsertionValue();

		for(int i=1; i<fixture.length; i++) {
			int index1 = finder.findFirstGreater(Arrays.copyOf(fixture, i), fixture[i], comparator);
			insertionValue.pickAndInsert(fixture, i, index1);
		}
	}
	
	
}
